#include <iostream>
using namespace std;

const int N = 110;
int dp[N][N];
int a[N][N];
int main() {
    int n;
    cin >> n;
    for(int i = 1;i<=n;i++)
    {
        for(int j = 1;j <= n;j++)
        {
            cin >> a[i][j];
            dp[i][j] = dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+a[i][j];
        }
    }

    int mmax = -0x3f3f3f3f;
    for(int i = 1;i<=n;i++)
    {
        for(int j = 1;j<=n;j++)
        {
            for(int k = i;k<=n;k++)
            {
                for(int l = j;l<=n;l++)
                {
                    mmax = max(mmax,dp[k][l] - dp[i-1][l] - dp[k][j-1] + dp[i-1][j-1]);
                }
            }
        }
    }
    cout << mmax << endl;
}
// 64 位输出请用 printf("%lld")